ozi: don't deinit a write stream if we don't have one.
authorRobert Lipe <robertlipe@users.noreply.github.com>
Tue, 27 Oct 2020 08:28:03 +0000 (03:28 -0500)
committerGitHub <noreply@github.com>
Tue, 27 Oct 2020 08:28:03 +0000 (03:28 -0500)
We can get into close() with a null stream_ TextStream. I think it has to do with ozi_openfile() reopening a file with a new name to match an extension of a certain type so it's renaming a file that hasn't been written. See issue #646

ozi.cc

diff --git a/ozi.cc b/ozi.cc
index 87f7e036d9900ba9b316cff2210f13480aa382e3..e496277bc029769fdd01ec0ff2a9c74960bf41a9 100644 (file)
--- a/ozi.cc
+++ b/ozi.cc
@@ -172,6 +172,9 @@ ozi_open_io(const QString& fname, QIODevice::OpenModeFlag mode)
 static void
 ozi_close_io()
 {
+  if (!stream) {
+    return;
+  }
   stream->close();
   delete stream;
   stream = nullptr;